package com.example.test.async;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
import java.util.concurrent.ExecutionException;

@RestController
public class AsyncController {
    @Resource
    private AsyncService asyncService;

    @GetMapping("/recognize")
    public String recognize() throws ExecutionException, InterruptedException {
        long begin = System.currentTimeMillis();
//        List<String> results = asyncService.recognize("/home/wangbo/图片/testimage/25face_25empty", 50,40);
//        List<String> results = asyncService.recognize("/home/wangbo/图片/testimage/50_empty", 50,40);
        List<String> results = asyncService.recognize("/home/wangbo/图片/testimage/50_face", 50,2);

        long end = System.currentTimeMillis();
        return String.format("总耗时：%d", end - begin);
    }
}
